package com.xty;

import com.xty.observer.concrereObserver.Observer1;
import com.xty.observer.concrereObserver.Observer2;
import com.xty.subject.concrereSubject.Subject1;
import com.xty.subject.concrereSubject.Subject2;

/**
 * Created By IntelliJ IDEA
 *
 * @author 许腾洋
 * @date 2021/11/22
 * description:
 */
public class Excute {
    public static void main(String[] args) {
        Observer1 observer1 = new Observer1();
        Observer2 observer2 = new Observer2();
        System.out.println("observer1:"+observer1);
        System.out.println("observer2:"+observer2);
        System.out.println("-------------------------------------------------------------------------------------------------------------");
        Subject1 subject1 = new Subject1();
        subject1.attach(observer1);
        subject1.attach(observer1);
        subject1.attach(observer2);
        subject1.operation();
        System.out.println("-------------------------------------------------------------------------------------------------------------");
        Subject2 subject2 = new Subject2();
        subject2.attach(observer1);
        subject2.attach(observer1);
        subject2.attach(observer2);
        subject2.operation();
    }
}
